<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <link rel="stylesheet" href="<s:url value="/resources"/>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/custom-theme/jquery-ui.custom.min.css" />	
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script> 
	<script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/json2.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/messages_zh.js"></script>
	
	<style type="text/css">
html, body {
	margin: 0;			 
	padding: 0;	 
    font-size: 85%;
}
#tab{
	width:99%;
	border:#F4F4F4 solid 4px;
	padding:0 2px 3px 2px;
	margin:10px 0 0 0;
	float:left;
}
#tab h1{
	display:block;
	width:95%;
	height:65px;	
	float:center;
	text-align: center;
	padding-top:20px;
}
#tab h1 span{
	width:250px;
	font:bold 26px/55px Arial, Helvetica, sans-serif;
	color:#327C8E;
	background-color:#fff;
	display:block;
}
.content1
{
	margin:0px;	
	padding:0px;
	width:100%;	
	font-size:12px;	
}
.content1 td
{    
    height:16px;
	line-height:16px;
	text-align:left;
	border-top-style:none;
	border-left-style:none;
	border-right-style:none;
	border-bottom-style:none;
}
.textbox
{
	width:90px;
	border:#000 1px solid;
}
.textboxs
{
	width:70px;
	border:#000 1px solid;
}
.longtextbox
{
	width:180px;
	border:#000 1px solid;
}

.shorttextbox {
	width: 50px;
	border: #000 1px solid;
}

.shorttextbox1 {
	width: 50px;
	border: #000 1px solid;
	background-color: #ddd;
}

.textarea
{
    overflow:auto;	
	border:#000 1px solid;
		
}
.select div {
  border:1px solid #000;
  float: left;
}
label{ display:block; }
fieldset { padding:0; border:0; margin-top:25px; }
label.error {  
        color: red;/*错误信息的颜色*/  
    }  
input.error {  
        border:1px dotted red;/*输入错误的输入框的边框样式*/  
    }		
	
	</style>
<script type='text/javascript'>
      
    
    function loadTabForHtxs(vvalue){
	$("#hetxs").val(vvalue);
    $("#hetxsname").val($("#hetxs").find("option:selected").text());
    }
    
    function changeTabForHttk(vvalue){ 
        //alert(vvalue);         
       var url = "<s:url value="/"/>/common/changeHttk?mbId="+vvalue;
       $.post(url,function(data){
       var json = eval('(' + data + ')');
       $( "#tkjson").val(data);
       $( "#httk").children().remove();       
       var dtable = document.getElementById("httk");
       for(var i=0; i<json.length; i++){
       jydzObj=json[i];
       var elTr = dtable.insertRow( -1 );
       var tkTd = elTr.insertCell( -1 );
       var tx ="<span id=\"tkh"+i+"\" >"+jydzObj.xh+"</span>";
       tkTd.innerHTML = tx;
       var idTd = elTr.insertCell( -1 );
       idTd.width="400px";
       var sx ="<span id=\"sx"+i+"\" >"+jydzObj.biaot+"</span>";
       idTd.innerHTML = sx;
       var jfTd = elTr.insertCell(-1);
       var jfyq="<textarea cols=\"142\" rows=\"2\" class=\"textarea\" name=\"neir\">"+jydzObj.neir+"</textarea>";     
       jfTd.innerHTML=jfyq;
       }
       });
    }
  //加载市信息
    function changForCity(value){ 
         $.getJSON("<s:url value="/cxtj"/>/changForCity", {province:value}, function(data){
                 //console.log(data[0]);
                 // var ret = eval('(' + data[0] + ')'); 
                 //console.log(ret);
                 //alert(data[1].regionname); 
                  $("#shi").empty();
                  $("#shi").append("<option value='-1' selected>==请选择==</option>");
		          for(var i=0;i<data.length;i++){
			        sObj = data[i];
			        $("#shi").append("<option value='"+sObj.regioncode+"'>"+sObj.regionname+"</option>");
		           } 
          }); 
       }
    function changeTabForDelivercity(vvalue, tabid, val) {
		var url = "<s:url value="/"/>/common/loadDelivercity";
		$.post(url, {
			"cityid" : vvalue
		}, function(data) {
			var json = eval('(' + data + ')');
			$("#" + tabid).empty();
			//$("#"+tabid).append("<option value='-1'>请选择</option>");       
			for ( var i = 0; i < json.length; i++) {
				if (json[i].regioncode == val) {
					$("#" + tabid).append(
							"<option value='"+json[i].regioncode+"' selected>"
									+ json[i].regionname + "</option>");
				} else {
					$("#" + tabid).append(
							"<option value='"+json[i].regioncode+"'>"
									+ json[i].regionname + "</option>");
				}

			}

		});
	}
    function changeTabForJsdw(vvalue,dwlx){
        var url = "<s:url value="/"/>/common/changeJsdw";
      
        if(dwlx=='1'){
        	 $.post(url,{qiyid:vvalue,qiylx:dwlx},function(data){ 
                 var data = eval('(' + data + ')'); 
                
                     $("#szs").val(data.chumdwjsrdz);
                     $("#sfddbr").val(data.chumdwjsrfddbr);
                     $("#swtdlr").val(data.chumdwjsrwtdlr);
                     $("#sdh").val(data.chumdwjsrdh);
                     $("#scz").val(data.chumdwjsrcz);
                     $("#syb").val(data.chumdwjsryzbm);
                     $("#skhyh").val(data.chumdwjsrkhyh);
                     $("#szh").val(data.chumdwjsrzh);
                     $("#sdjh").val(data.chumdwjsrnsrdjh);
                     $("#cmdwjsrmc").val( $("#chumdwjsrbm").find("option:selected").text()); 
                  
                 }); 
        }else{
        	if(vvalue==document.getElementById("msrid").value){
        		 $("#bzs").val(document.getElementById("zs").value);
                 $("#bfddbr").val(document.getElementById("fddbr").value);
                 $("#bwtdlr").val(document.getElementById("wtdlr").value);
                 $("#bdh").val(document.getElementById("dh").value);
                 $("#bcz").val(document.getElementById("cz").value);
                 $("#byb").val(document.getElementById("yb").value);
                 $("#bkhyh").val(document.getElementById("khyh").value);
                 $("#bzh").val(document.getElementById("zh").value);
                 $("#bdjh").val(document.getElementById("djh").value);
                 $("#msdwjsrmc").val( $("#maisdwjsrbm").find("option:selected").text()); 
        	}else{
        		$.post(url,{qiyid:vvalue,qiylx:dwlx},function(data){ 
                    var data = eval('(' + data + ')'); 
                   
                    $("#bzs").val(data.maisdwjsrdz);
                    $("#bfddbr").val(data.maisdwjsrfddbr);
                    $("#bwtdlr").val(data.maisdwjsrwtdlr);
                    $("#bdh").val(data.maisdwjsrdh);
                    $("#bcz").val(data.maisdwjsrcz);
                    $("#byb").val(data.maisdwjsryzbm);
                    $("#bkhyh").val(data.maisdwjsrkhyh);
                    $("#bzh").val(data.maisdwjsrzh);
                    $("#bdjh").val(data.maisdwjsrnsrdjh);
                    $("#msdwjsrmc").val( $("#maisdwjsrbm").find("option:selected").text()); 
           		 });
        	}
   
    	}
    }
    
    
    
    function changeTabForYyz(){
    //alert($("#yingyz").find("option:selected").text());
    $( "#yyzmc").val( $("#yingyz").find("option:selected").text());   
    }
    
   
    
    function changeTabForFhdw(){
    $("#fahdwmc").val($("#fahdwbm").find("option:selected").text());
    }
    
    function changeTabForHyls(){    
    $("#hangylsname").val($("#hangy").find("option:selected").text());
    }
    
    function changeTabForJglx(){
    $("#jiaglxmc").val($("#jiaglx").find("option:selected").text());
    }
    
    
    function changeTabForCmr(val){ 
      var dwbm = ${sysuser.orgid}; 
      var url = "<s:url value="/"/>/common/changeCmr";       
      $.post(url,{qiyid:val},function(data){
            var json = eval('(' + data + ')');
            $("#qiymc").val(json[0].danwmc);
            $("#chumdwdz").val(json[0].zhus);
            $("#chumdwfddbr").val(json[0].faddbr);
            $("#chumdwwtdlr").val(json[0].weitdlr);
            $("#chumdwdh").val(json[0].dianh);
            $("#chumdwcz").val(json[0].chuanz);
            $("#chumdwyzbm").val(json[0].youzbm);
            $("#chumdwkhyh").val(json[0].kaihyh);
            $("#chumdwzh").val(json[0].yinhzh);
            $("#chumdwnsrdjh").val(json[0].nasrdjh);
            $("#cmrmc").val(json[0].danwmc);
            if(dwbm==val){
            $("#cmrlx").val('1');
            }else{
            $("#cmrlx").val('2');
            }
            });
      }      
   
    
    function loadMonthCss(){
    var sDate=$("#cDate").val();
    sDate = sDate.substring(5,7);
    if(sDate=='01'){
    replaseCss($("#jan0"));
    replaseCss($("#feb0"));
    replaseCss($("#mar0"));
    replaseCss($("#apr0"));
    replaseCss($("#may0"));
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='02'){
    replaseCss($("#feb0"));
    replaseCss($("#mar0"));
    replaseCss($("#apr0"));
    replaseCss($("#may0"));
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='03'){
    replaseCss($("#mar0"));
    replaseCss($("#apr0"));
    replaseCss($("#may0"));
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='04'){
    replaseCss($("#apr0"));
    replaseCss($("#may0"));
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='05'){    
    replaseCss($("#may0"));
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='06'){
    replaseCss($("#jun0"));
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='07'){
    replaseCss($("#jul0"));
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='08'){
    replaseCss($("#aug0"));
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='09'){
    replaseCss($("#sep0"));
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='10'){
    replaseCss($("#oct0"));
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));    
    }
    if(sDate=='11'){
    replaseCss($("#nov0"));
    replaseCss($("#dec0"));
    }
    if(sDate=='12'){
    replaseCss($("#dec0"));
    }   
    }
    
    function replaseCss(d){    
    d.removeClass("shorttextbox1");
    d.addClass("shorttextbox");
    d.removeAttr("readonly");
    }
    
    function recoverCSs(d){
    d.val("");
    d.removeClass("shorttextbox");
    d.addClass("shorttextbox1");
    d.attr("readonly","readonly"); 
    }
    
    function loadCmrJsdwForCombox(){
        var url = "<s:url value="/"/>/common/loadJsdw";
       $.post(url,function(data){
            var json = eval('(' + data + ')');
            $("#chumdwjsrbm").empty();
            $("#chumdwjsrbm").append("<option value='${htinfo.chumdwjsrbm}' selected>${htinfo.chumdwjsrmc}</option>"); 
            for(var i=0;i<json.length;i++){            
            $("#chumdwjsrbm").append("<option value='"+json[i].sysid+"'>"+json[i].mingch+"</option>");
            }
            });
    }
    
    function loadCmrData(){
        var url = "<s:url value="/"/>/common/loadCmr";       
        $.post(url,function(data){
            var json = eval('(' + data + ')'); 
        if(json.length>0){   
        $("#cmrbm").empty();     
        $("#cmrbm").append("<option value=${htinfo.chumdwbm} seleted>${htinfo.chumdwmc}</option>");
        for(var i=1;i<json.length;i++){
        //alert(projects[i].name);
        $("#cmrbm").append("<option value='"+json[i].chumdwbm+"'>"+json[i].chumdwmc+"</option>");
        }
        }        
       
        });
        $("#cmrmc").val("${htinfo.chumdwmc}");
        $("#qiymc").val("${htinfo.chumdwmc}");
        $("#chumdwdz").val("${htinfo.chumdwdz}");
        $("#chumdwfddbr").val("${htinfo.chumdwfddbr}");
        $("#chumdwwtdlr").val("${htinfo.chumdwwtdlr}");
        $("#chumdwdh").val("${htinfo.chumdwdh}");
        $("#chumdwcz").val("${htinfo.chumdwcz}");
        $("#chumdwyzbm").val("${htinfo.chumdwyzbm}");
        $("#chumdwkhyh").val("${htinfo.chumdwkhyh}");
        $("#chumdwzh").val("${htinfo.chumdwzh}");
        $("#chumdwnsrdjh").val("${htinfo.chumdwnsrdjh}");
    }
    
    function loadMsrData(){
        var url = "<s:url value="/"/>/common/loadMsrForAuto";          
        $.post(url,function(data){ 
          var projects = eval('(' + data + ')'); 
          //alert(projects);
         $( "#msr").autocomplete({            
         	    minLength:2,       	    			
  			source:projects,			
              select: function( event, ui ) {
              //alert(ui.item.label);	
                 url = "<s:url value="/"/>/common/loadMsrJsdw";
                 $.post(url,{qiyid:ui.item.value},function(data){
              	   //alert(data);
                  var json = eval('(' + data + ')');                
                  $("#maisdwjsrbm").empty(); 
                  $("#maisdwjsrbm").append("<option value="+ui.item.value+">"+ui.item.label+"</option>");      
                    for(var i=0;i<json.length;i++){
                       if(ui.item.value==json[i].jiesdwbm){
                          continue;
                       }                
                    $("#maisdwjsrbm").append("<option value='"+json[i].jiesdwbm+"'>"+json[i].jiesdwmc+"</option>");
                    }
                 });
  				$( "#msr" ).val( ui.item.label );
  				$( "#msrid" ).val( ui.item.maisdwbm );							
  				$( "#maisr").val( ui.item.label );
  				$( "#zs").val( ui.item.maisdwdz );
  				$( "#fddbr" ).val( ui.item.maisdwfddbr );	
  				$( "#wtdlr" ).val( ui.item.maisdwwtdlr );	
  				$("#dh").val(ui.item.maisdwdh);	
  				$("#cz").val(ui.item.maisdwcz);	
  				$("#yb").val(ui.item.maisdwyzbm);	
  				$("#khyh").val(ui.item.maisdwkhyh);	
  				$("#zh").val(ui.item.maisdwzh);	
  				$("#djh").val(ui.item.maisdwnsrdjh);	
  				$("#msrssdwbm").val(ui.item.maisdwbm);
  				$("#msrssdwmc").val(ui.item.label);
  				
  				$("#maisdwjsrbm").val(ui.item.maisdwbm);
  				$("#msdwjsrmc").val(ui.item.label);
  				$("#bzs").val(ui.item.maisdwdz);
  				$("#bfddbr").val(ui.item.maisdwfddbr);
  				$("#bwtdlr").val(ui.item.maisdwwtdlr);
  				$("#bdh").val(ui.item.maisdwdh);
  				$("#bcz").val(ui.item.maisdwcz);
  				$("#byb").val(ui.item.maisdwyzbm);
  				$("#bkhyh").val(ui.item.maisdwkhyh);
  				$("#bzh").val(ui.item.maisdwzh);
  				$("#bdjh").val(ui.item.maisdwnsrdjh);
  				$("#msridwithmc").val(ui.item.value+ui.item.label);
  				
  				//$("#shr0").val(ui.item.label);
  				//$("#shrid0").val(ui.item.maisdwbm);
  				
  				//$("#maisdwjsrbm").val(ui.item.maisdwjsrbm);
  				//$("#msdwjsrmc").val(ui.item.maisdwjsrmc);
  				//$("#bzs").val(ui.item.maisdwjsrdz);
  				//$("#bfddbr").val(ui.item.maisdwjsrfddbr);
  				//$("#bwtdlr").val(ui.item.maisdwjsrwtdlr);
  				//$("#bdh").val(ui.item.maisdwjsrdh);
  				//$("#bcz").val(ui.item.maisdwjsrcz);
  				//$("#byb").val(ui.item.maisdwjsryzbm);
  				//$("#bkhyh").val(ui.item.maisdwjsrkhyh);
  				//$("#bzh").val(ui.item.maisdwjsrzh);
  				//$("#bdjh").val(ui.item.maisdwjsrnsrdjh);
  				//$("#msridwithmc").val(ui.item.value+ui.item.label);
  				return false;

  			}
  		});
      });
      }

    function loadFhdwData(){
       var url = "<s:url value="/"/>/common/loadFhdw";     
      $.post(url,function(data){ 
        var projects = eval('(' + data + ')'); 
        //alert(projects);
       $( "#fahdwmc").autocomplete({
			minLength:2,
			source:projects,			
            select: function( event, ui ) {
            //alert(ui.item.label);	
				$( "#fahdwmc").val( ui.item.label );							
				$( "#fahdwbm").val( ui.item.value );						
				return false;

			}
		});
    });
    }
    
    function loadShdwData(i){
    var url = "<s:url value="/"/>/common/loadShdw";    
      $.post(url,function(data){ 
        var projects = eval('(' + data + ')'); 
        //alert(projects);
       $( "#shr"+i).autocomplete({
			minLength: 0,
			source:projects,			
            select: function( event, ui ) {
            //alert(ui.item.label);	
				$( "#shr"+i ).val( ui.item.label );							
				$( "#shrid"+i ).val( ui.item.value );						
				return false;

			}
		});
    });
    }
    
    function loadMsrjsdwForCombox(){
        var msrjsdwbm = '${htinfo.maisdwjsrbm}';
        var url = '<s:url value="/"/>/common/loadMsrJsdw';       
        $.post(url,{qiyid:msrjsdwbm},function(data){
            var json = eval('(' + data + ')');           
        $("#maisdwjsrbm").empty();        
        $("#maisdwjsrbm").append("<option value='${htinfo.maisdwjsrbm}'>${htinfo.maisdwjsrmc}</option>");      
        for(var i=0;i<json.length;i++){
        //alert(projects[i].name);
        $("#maisdwjsrbm").append("<option value='"+json[i].jiesdwbm+"'>"+json[i].jiesdwmc+"</option>");
        }
        });
    }
    
    function loadZlzbWithHetid(){
        var hetid = '${htinfo.hetid}';
        var url = '<s:url value="/"/>/common/loadZlzbWithHetid';       
        $.post(url,{hetid:hetid},function(data){                 
        $("#zbAry").val(data);
        });
    }
    
    function loadHttkWithHetid(){
        var hetid = '${htinfo.hetid}';
        var url = '<s:url value="/"/>/common/loadHttkWithHetid';       
        $.post(url,{hetid:hetid},function(data){                 
        $("#tkjson").val(data);
        });
    }
   
    $(function(){ 
        loadCmrData();
        loadCmrJsdwForCombox();
        loadZlzbWithHetid();
        loadHttkWithHetid();
        loadShdwData(0);
        loadFhdwData(); 
        loadMsrData();        
        loadMsrjsdwForCombox();
        var dy = ${htinfo.daodssd};

		var dysh = dy + "";
		var dysheng = dysh.substring(0, 2);
		changeTabForDelivercity("100000", "sheng", dysheng + "0000");
		changeTabForDelivercity(dysheng + "0000", "shi", dy);
        loadTabForHtxs(${htinfo.hetxs});  
		$("#jiaglx").val(${htinfo.jiaglx});
	    $("#hangy").val(${htinfo.hangy});  
	    $("#psfs").val(${htinfo.psfs}); 
        $("#but1").button();
        $("#but2").button();
        $("#but3").button();
        $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);
        $( "#kssj" ).datepicker($.datepicker.regional[ "zh-CN" ]);
        $( "#jssj" ).datepicker($.datepicker.regional[ "zh-CN" ]);        
		$( "#pzgg" ).dialog({
		    autoOpen: false,
		    modal: true
		   }); 
		 tj(); 
		    
    });
    
    
	
	function tj(){	 
	  /**  
     * 自定义验证规则——增加对select的验证  
     */  
    $.validator.addMethod(    
        "selectNone", 
        function(value, element)
        {   
            if (value == "-1") 
            {    
                return false;    
            }    
            else    
            {   
                return true;    
            }   
        },    
        "必须选择一项" 
    );   
	
	$("#form1").validate({
	       rules: {
	       "hetlrbh": "required",
	       "maisdwmc":"required",
	       "daodssd":"required",
	       "shouhdwmc":"required", 
	       "pinzgg":"required",
	       "fahdwmc":"required",
	       maisr:"required",
	       "chumdwbm":{
	       selectNone:true
	       },
	       "yingyzhmjglzbm":{
	       selectNone:true
	       },
	       sheng:{
	       selectNone:true
	       },
	       "daodssd":{
	       selectNone:true
	       },
	       "fahdwbm":{
	       selectNone:true
	       },
	       "hangy":{
	       selectNone:true
	       },
	       "chumdwjsrbm":{
	       selectNone:true
	       },
	       "maisdwjsrbm":{
	       selectNone:true
	       },
	       "daodssd":{
		       selectNone:true
		    },
	       "shul":{
	       required: true, 
	       digits:true,
	       range:[0,9999999]
	       }
	       },
		   messages: {
		   "chumdwbm":"请选择出卖人",
		   //"ht.hetlrbh":"请输入合同号",
		   "maisdwmc":"请选择买受人",
		   maisr:"请选择买受人",
		   "daodssd":"请选择到达省市",
		   "hetxs":"请选择合同形式",
	       "fahdwmc":"请选择发货单位",
	       "hangy":"请选择隶属行业",
	       "chumdwjsrbm":"请选择出卖人结算单位",
	       "maisdwjsrbm":"请选择买受人结算单位",	       
		   "shouhdwmc":"请选择收货单位",
		   "pinzgg":"请选择品种规格",
		   "daodssd":"请选择到达省市",
		   "shul":{
	       required: "请输入数量", 
	       digits:"请输入整数",
	       range:jQuery.validator.format("请输入一千万吨之内的数")
	       }
		   
		   }
		   });
		   $("#but1").click(function(){		   
		    if($("#form1").valid()){
		       var flag = true;
		       var msg = "";
		       if(document.getElementById("chumdwjsrbm").value==""){
		           msg ="请定制后选择出卖人结算单位";
		           flag = false;
		        }
		       if(document.getElementById("msrid").value==""){
		           msg ="请选择买受人";
		           flag = false;
		        }
		        if(document.getElementById("fahdwbm").value==""){
		           msg ="请选择发货单位";
		           flag =  false;
		        }
		        if(document.getElementById("shrid0").value==""){
		           msg ="请选择收货单位";
		           flag =  false;
		        }	
		        if(document.getElementById("zlzb0").value==""){
		           msg = "请录入质量指标";
		           flag =  false;
		        }	        
		        if(document.getElementById("mzbm0").value=="-1"){
		           msg ="请点击品种规格后选择煤种";
		           flag =  false;
		        }
		        if(document.getElementById("pzbm0").value=="-1"){
		           msg ="请点击品种规格后选择品种";
		           flag =  false;
		        }
		        
		        if(document.getElementById("fazbm").value=="-1"){
		           msg = "请选择发站";
		           flag =  false;
		        }
		        if(document.getElementById("daozbm").value=="-1"){
		           msg = "请选择到站";
		           flag =  false;
		        }
		        
		        if(parseFloat(document.getElementById("shul0").value)!=parseFloat(GetYueZJ())){
		          msg ="报单总数量和分月数量不等,请重新填写";
		          flag = false;
		        }
		        //if(document.getElementById("isRepeat").value=="1"){
		        //  msg = "企业合同号已存在,请重新填写";
		        //  flag = false;
		       // }
		       // if(document.getElementById("isZgdw").value=="1"){
		       //   msg = "主管单位不存在或主管单位不符合要求";
		       //   flag = false;
		       // }
		        if(document.getElementById("msridwithmc").value!=(document.getElementById("msrid").value+document.getElementById("msr").value)){
		          msg = "买受人名称不符合要求";
		          flag = false;
		    }
		      
		    if(flag){
		         var url = "<s:url value="/"/>/htgl/modifyNdbd";
		         $("#form1").ajaxSubmit({
		              url:url,
		              type:'post',
		              success:function(data){
		              var json =eval('(' + data + ')');
					    if(json.result==1){
					    alert("修改成功，请【提报】进行确认！");
					    window.returnValue=1;
                        window.close();					   
					   }else{
					    alert("修改失败！");
					    //window.returnValue=1;
                        //window.close();
					   }
		              }
		         });
		    }else{
		          alert(msg);
		        }
		         		          
		        }
		       });
		       
		    $("#but2").click(function(){
		    if($("#form1").valid()){
		       var flag = true;
		       var msg = "";	
		       if(document.getElementById("chumdwjsrbm").value==""){
		           msg ="请定制后选择出卖人结算单位";
		           flag = false;
		        }
		       if(document.getElementById("msrid").value==""){
		           msg ="请选择买受人";
		           flag = false;
		        }
		        if(document.getElementById("fahdwbm").value==""){
		           msg ="请选择发货单位";
		           flag =  false;
		        }
		        if(document.getElementById("zlzb0").value==""){
		           msg = "请录入质量指标";
		           flag =  false;
		        }
		        if(document.getElementById("shrid0").value==""){
		           msg ="请选择收货单位";
		           flag =  false;
		        }		        
		        if(document.getElementById("mzbm0").value=="-1"){
		           msg ="请点击品种规格后选择煤种";
		           flag =  false;
		        }
		        if(document.getElementById("pzbm0").value=="-1"){
		           msg ="请点击品种规格后选择品种";
		           flag =  false;
		        }
		        if(document.getElementById("fazbm").value=="-1"){
		           msg = "请选择发站";
		           flag =  false;
		        }
		        if(document.getElementById("daozbm").value=="-1"){
		           msg = "请选择到站";
		           flag =  false;
		        }     
		        if(parseFloat(document.getElementById("shul0").value)!=parseFloat(GetYueZJ())){
		          msg ="报单总数量和分月数量不等,请重新填写";
		          flag = false;
		        }
		        
		        //if(document.getElementById("isRepeat").value=="1"){
		         // msg = "企业合同号已存在,请重新填写";
		          //flag = false;
		        //}
		        //if(document.getElementById("isZgdw").value=="1"){
		         // msg = "主管单位不存在或主管单位不符合要求";
		         // flag = false;
		        //}
		        
		        if(document.getElementById("msridwithmc").value!=(document.getElementById("msrid").value+document.getElementById("msr").value)){
		          msg = "买受人名称不符合要求";
		          flag = false;
		        }
		        
		        if(flag){
		        var htzt = ${htinfo.zhuangt};		       
		        var url =htzt=='0'?"<s:url value="/"/>/htgl/modifyAndSubmitNdbd":"<s:url value="/"/>/htgl/modifyAndSubmitOfBackNdbd";
		        //var url = "<s:url value="/"/>/htgl/modifyAndSubmitNdbd";
		       
		         $("#form1").ajaxSubmit({
		              url:url,
		              type:'post',
		              success:function(data){
		              var json =eval('(' + data + ')');
					    if(json.result==1){
					    alert("提报成功！");
					    window.returnValue=1;
                        window.close();					   
					   }else{
					    alert("保存失败！");
					    //window.returnValue=1;
                        //window.close();
					   }
		              }
		         });
		           }else{
		           alert(msg);
		           }
		        	       
		        
		        }
		       }); 
	  
	  }
	  
	  function comptime(time1, time2) {
        var d1 = new Date(time1.replace(/-/g, "/"));
        var d2 = new Date(time2.replace(/-/g, "/"));
        if(Date.parse(d1) - Date.parse(d2) > 0)
                return true;
        else
                return false;
}
	function encodefh(str)
		{		
		str=str.replace(">","d");
		str=str.replace("≥","dd");
		str=str.replace("<","x");
		str=str.replace("≤","xd");
		
		return str;
		}
	function clickPzgg(i){
	//alert(i);

	}
	
	function txtzjl_onblur(i) {           
            if ($("#shul"+i).val() != "") {
                var zjsl = parseFloat($("#shul"+i).val());
                var yuesl = zjsl / 12;
                var intyue = parseInt(yuesl);
                var syysl = intyue * 11;
                var srysl = zjsl - syysl;
                SetYueZJ(i,intyue, srysl);
                return;
            }
            SetYueZJ(i,0, 0);
        }

        function SetYueZJ(i,yuesl, srysl) {
            if(yuesl==0){
            $("#shul"+i).val(yuesl)
            }
            $("#jan"+i).val(yuesl);
            $("#feb"+i).val(yuesl);
            $("#mar"+i).val(yuesl);
            $("#apr"+i).val(yuesl);
            $("#may"+i).val(yuesl);
            $("#jun"+i).val(yuesl);
            $("#jul"+i).val(yuesl);
            $("#aug"+i).val(yuesl);
            $("#sep"+i).val(yuesl);
            $("#oct"+i).val(yuesl);
            $("#nov"+i).val(yuesl);
            $("#dec"+i).val(srysl);            
        }
        
     function txtyuesl_onblur(i) {            
            
            var temp = GetYueZJ(i);
            if (isNaN(temp)) {
                $("#shul"+i).val(0);                
            }
            else {
                $("#shul"+i).val(temp);                
            }

        }

        function GetYueZJ(i) { 
             var yue1 =parseFloat($("#jan0").val()==''?0:$("#jan0").val());            
            var yue2 = parseFloat($("#feb0").val()==''?0:$("#feb0").val());
            var yue3 = parseFloat($("#mar0").val()==''?0:$("#mar0").val());
            var yue4 = parseFloat($("#apr0").val()==''?0:$("#apr0").val());
            var yue5 = parseFloat($("#may0").val()==''?0:$("#may0").val());
            var yue6 = parseFloat($("#jun0").val()==''?0:$("#jun0").val());
            var yue7 = parseFloat($("#jul0").val()==''?0:$("#jul0").val());
            var yue8 = parseFloat($("#aug0").val()==''?0:$("#aug0").val());
            var yue9 = parseFloat($("#sep0").val()==''?0:$("#sep0").val());
            var yue10 = parseFloat($("#oct0").val()==''?0:$("#oct0").val());
            var yue11 = parseFloat($("#nov0").val()==''?0:$("#nov0").val());
            var yue12 = parseFloat($("#dec0").val()==''?0:$("#dec0").val()); 

            var yuezj = yue1 + yue2 + yue3 + yue4 + yue5 + yue6 + yue7 + yue8 + yue9 + yue10 + yue11 + yue12;
            return yuezj;
        }
     
     function jsdxxHide(){
     $("#jsdnr1").hide();
     $("#jsdnr").show();
        $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        });   
     }  
     
     function jsdxxShow(){
     $("#jsdnr").hide();
     $("#jsdnr1").show();
     $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       }); 
       $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     } 
     
     function comptime(time1, time2) {
        var d1 = new Date(time1.replace(/-/g, "/"));
        var d2 = new Date(time2.replace(/-/g, "/"));
        if(Date.parse(d1) - Date.parse(d2) > 0)
                return true;
        else
                return false;
}

function checkZgdw(){    
    var dwbm =${sysuser.orgid};
    var url = "htgl/isZgdwJqgrid.action?dwbm="+dwbm;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            //alert(json.result);
            if(json.result==0){
              document.getElementById("isZgdw").value="1";
            }
            });
}

    
    function clickPzgg(i){
     openwindow('findZlzbView','500','700');
    }
    
    function clickFaz(i){
     openwindow('findFazView','300','400');
    }
    
    function clickDaoz(i){
     openwindow('findDaozView','300','400');
    }
    
    function openwindow(url,sheight,swidth){
       var winoption ="dialogHeight:"+sheight+"px;dialogWidth:"+ swidth +"px;status:yes;scroll:yes;resizable:yes;center:yes";
       window.showModalDialog(url,window,winoption);
    }
	
	</script>

</head>

<body>

	<div id="tab">
		<h1>煤炭交易合同</h1>
		<form name="form1" id="form1">
			<table id="list_search" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td>出卖人（销方）:</td>
					<td>
						<div class="select">
							<div>
								<select id="cmrbm" style="width:180px;" name="chumdwbm"
									onchange="changeTabForCmr(this.value)">
									<option value="${htinfo.chumdwbm}" selected>${htinfo.chumdwmc}</option>
								</select>
							</div>
						</div> <input type="hidden" name="chumdwmc" id="cmrmc"
						value="${htinfo.chumdwmc}"> <input type="hidden"
						name="chumrlx" id="cmrlx" value="${htinfo.chumrlx}"> <input
						type="hidden" name="chumrssdwmc" value="${htinfo.chumrssdwmc}">
						<input type="hidden" name="chumrssdwbm"
						value="${htinfo.chumrssdwbm}">
					</td>
					<td>企业合同号:</td>
					<td><input id="hetlrbh" type="text" name="hetlrbh"
						class="longtextbox" value="${htinfo.hetlrbh}" readonly/></td>
					<input type="hidden" name="hetbh" value="${htinfo.hetbh}">
					<input type="hidden" name="hetid" value="${htinfo.hetid}">
					<input type="hidden" id="zhuangta" name="zhuangt" value="${htinfo.zhuangt}">
					<td>  
                                             发站:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>  
            </td>
            <td>
            	<input id="fazmc" type="text" name="fazmch" class="longtextbox" value="${htinfo.fazmch}" onclick="clickFaz();" readonly="true"/>
                <input type="hidden" id="fazbm" name="fazbm" value="${htinfo.fazbm}">
                <input type="hidden" id="xianzkid1" name="xianzkid1">
                <input type="hidden" id="xianzkmc1" name="xianzkmc1">
                <input type="hidden" id="xianzkid2" name="xianzkid2">
                <input type="hidden" id="xianzkmc2" name="xianzkmc2">
                <input type="hidden" id="xianzkid3" name="xianzkid3">
                <input type="hidden" id="xianzkmc3" name="xianzkmc3">
                <input type="hidden" id="xianzkid4" name="xianzkid4">
                <input type="hidden" id="xianzkmc4" name="xianzkmc4">
                
            </td> 
				</tr>

				<tr>
					<td>买受人（购方）:</td>
					<td><input id="msr" name="maisdwmc" type="text"
						class="longtextbox" value="${htinfo.maisdwmc}" /> <input
						id="msrid" type="hidden" name="maisdwbm"
						value="${htinfo.maisdwbm}"> <input id="msrssdwmc"
						type="hidden" name="maisrssdwmc" value="${htinfo.maisrssdwmc}">
						<input id="msrssdwbm" type="hidden" name="maisrssdwbm"
						value="${htinfo.maisrssdwbm}">
						<input id="msridwithmc" type="hidden" value="${htinfo.maisdwbm}${htinfo.maisdwmc}">
					</td>
					<td>签约地点:</td>
					<td><input type="text" name="qianydd" class="longtextbox"
						value="中国(太原)煤炭交易中心" readonly /></td>
					<td>
                                          到站:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>            	 
            	<input id="daozmc" type="text" name="daozmch" value="${htinfo.daozmch}" class="longtextbox" onclick="clickDaoz();" readonly="true"/>                
                <input type="hidden" id="daozbm" name="daozbm" value="${htinfo.daozbm}"> 
                <input type="hidden" id="zyx" name="zhuanyx">
                <input type="hidden" id="zzgid" name="huangzgid">
                <input type="hidden" id="zzgmc" name="huangzgmc">
                <input type="hidden" id="jxgid" name="zhongdgid">
                <input type="hidden" id="jxgmc" name="zhongdgmc">
            </td> 
				</tr>

				<tr>
					<td>合同形式:</td>
					<td>
						<div class="select"><div>
            	
            	<select id="hetxs" name="hetxs" style="width:180px" onchange="changeTabForHtxs(this.value);">
            	  <option value="${htinfo.hetxs}" selected>${htinfo.hetxsname}</option>
                  <option value="3">省内铁路</option>
                  <option value="4">铁路出省</option> 
                 </select>
            	
            	</div></div> 
            	<input type="hidden" id="hetxsname" name="hetxsname" value="${htinfo.hetxsname}">
					</td>
					<td>价格类型:</td>
					<td>
						<div class="select">
							<div>
								<select id="jiaglx" name="jiaglx" style="width:180px" onchange="changeTabForJglx(this.value);">
            	<option value="${htinfo.jiaglx}" selected>${htinfo.jiaglxmc}</option>
                   <c:forEach var="jglx" items="${jglxList}">
                   <option value="${jglx.diccode}">
                   ${jglx.dicname}
                   </option>
                   </c:forEach>
                 </select> 
							</div>
						</div> <input type="hidden" id="jiaglxmc" name="jiaglxmc"
						value="${htinfo.jiaglxmc}">
					</td>
					<td>隶属行业:</td>
					<td>
						<div class="select">
							<div>
								<select id="hangy" name="hangy" style="width:180px" onchange="changeTabForHyls()">
            	<option value="${htinfo.hangy}" selected>${htinfo.hangylsname}</option>
                   <c:forEach var="hy" items="${hyList}">
                   <option value="${hy.diccode}">
                   ${hy.dicname}
                   </option>
                   </c:forEach>
                 </select>
							</div>
						</div> <input type="hidden" id="hangylsname" name="hangylsname"
						value="${htinfo.hangylsname}">
					</td>
				</tr>

				<tr>
					<td>发货单位:</td>
					<td><input id="fahdwmc" name="fahdwmc" type="text"
						class="longtextbox" title="请录入汉字关键字选择发货单位"
						value="${htinfo.fahdwmc}" /> <input id="fahdwbm" type="hidden"
						name="fahdwbm" value="${htinfo.fahdwbm}">
					</td>
					<td>
            	是否中长期合同:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
                <div class="select"><div>
                <select id="iszcx" name="iszcx" style="width:180px">
            	<option value="${htinfo.iszcx}" selected>${htinfo.iszcxmc}</option>
                  <option value="1">是</option>
                  <option value="0">否</option> 
                 </select>
                </div></div> 
                <!--  <input type="hidden" name="iszcx" value="${htinfo.iszcx}">-->
            </td>
					<td>签订时间:</td>
					<td><input id="datepicker" type="text" class="textbox"
						name="qianysj" value="${htinfo.qianysj}" readonly /> <input
						type="hidden" name="zidqysj" value="${htinfo.zidqysj}">
					</td>

				</tr>
		<tr>
        	<td>
            	到达省市:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
             <td>          	 
        	     <select class="form-textbox" style="width: 93px;" onchange="changForCity(this.value)" id="sheng">
        	            <option value="-1">==请选择==</option>
						<c:forEach var="province" items="${provincelist}">
							<option value="${province.regioncode}" >${province.regionname}</option>
						</c:forEach>
		           </select>
        	       <select id="shi" class="form-textbox" style="width: 93px;" name="daodssd" >
        	            <option value="-1" selected>==请选择==</option>
		            </select>
            </td>
           <td></td>
              <td></td>
              <td></td>
              <td></td>          
        </tr>
				<tr>
					<td colspan="6" style="padding-top:5px;">一、收货人名称、品种规格、数量、单价</td>
				</tr>
				<tr>
					<td colspan="6" style="padding:1px;">
						<table id="changdi" align="center" cellpadding="0" cellspacing="0"
							class="content_gridview" border="1">
							<thead>
								<tr>
									<th rowspan="3">收货人名称</th>
									<th rowspan="3">品种规格</th>
									<th rowspan="3">质量指标</th>
									<th rowspan="3">价格<br />(元/吨)</th>
									<th colspan="13">交（提）货时间、煤量（吨）</th>
								</tr>
								<tr>
								        <th rowspan="2">全年合计<br><a href="#" onclick="txtzjl_onblur(0);" style="text-decoration:none;cursor: hand">
								        <img src="<s:url value="/resources"/>/images/pinf.gif" border=0 alt="平分" align= "absmiddle" height="18"  width="18"></a>&nbsp;&nbsp;
								        <a href="#" onclick="SetYueZJ(0,0,0);" style="border:0px;text-decoration:none;cursor: hand">
								        <img src="<s:url value="/resources"/>/images/qinl.gif"  border=0 alt="清零" align="absmiddle" height="18"  width="18"></a></th>
									<th colspan="3">一季度</th>
									<th colspan="3">二季度</th>
									<th colspan="3">三季度</th>
									<th colspan="3">四季度</th>
								</tr>
								<tr>
									<th>1</th>
									<th>2</th>
									<th>3</th>
									<th>4</th>
									<th>5</th>
									<th>6</th>
									<th>7</th>
									<th>8</th>
									<th>9</th>
									<th>10</th>
									<th>11</th>
									<th>12</th>
								</tr>
							</thead>
							<tbody>
									<tr>
										<td><textarea id="shr0" cols="15" rows="3" name="shouhdwmc" class="textarea">${htinfo.shouhdwmc}</textarea>
											<input id="shrid0" type="hidden" name="shouhdwbm" value="${htinfo.shouhdwbm}" /> 
										</td>
										<td><textarea id="fh0" cols="12" rows="3" name="pinzgg" class="textarea" readonly="true" onClick="clickPzgg(0);">${htinfo.pinzgg}</textarea>
											<input type="hidden" id="mzbm0"	name="meizbm" value="${htinfo.meizbm}"> 
											<input	type="hidden" id="mzmc0" name="meiz" value="${htinfo.meiz}">
											<input	type="hidden" id="pzbm0" name="pinzbm" value="${htinfo.pinzbm}"> 
											<input	type="hidden" id="pzmc0" name="pinz" value="${htinfo.pinz}">											
											<input type="hidden" name="hej"	value="${htinfo.hej}">
											<input type="hidden" name="htkzid"	value="${htinfo.htkzsysid}">
										</td>
										<td><textarea id="zlzb0" cols="30" rows="3"	class="textarea" name="zhilzb" readonly="true">${htinfo.zhilzb}</textarea>
											<input type="hidden" id="zlzbfz0" name="zhilzbfzbm" value="${htinfo.zhilzbfzbm}">
											<input type="hidden" id="zbAry" name="zb">
											<input type="hidden" id="ppname" name="pinp">
                                            <input type="hidden" id="ppid" name="pinpid">
										</td>
										<td>
										<input id="jiag0" type="text" class="shorttextbox" name="jiag" value="<fmt:formatNumber value="${htinfo.jiag}" pattern="###.##"/>" />
										</td>
										<td><input id="shul0" type="text"
											class="textboxs" name="shul"
											value="<fmt:formatNumber value="${htinfo.shul}" pattern="###"/>">
										</td>
										<td><input id="jan0" type="text"
											class="shorttextbox" name="gml1" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml1}" pattern="###"/>">
										</td>
										<td><input id="feb0" type="text"
											class="shorttextbox" name="gml2" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml2}" pattern="###"/>">
										</td>
										<td><input id="mar0" type="text"
											class="shorttextbox" name="gml3" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml3}" pattern="###"/>">
										</td>
										<td><input id="apr0" type="text"
											class="shorttextbox" name="gml4" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml4}" pattern="###"/>">
										</td>
										<td><input id="may0" type="text"
											class="shorttextbox" name="gml5" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml5}" pattern="###"/>">
										</td>
										<td><input id="jun0" type="text"
											class="shorttextbox" name="gml6" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml6}" pattern="###"/>">
										</td>
										<td><input id="jul0" type="text"
											class="shorttextbox" name="gml7" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml7}" pattern="###"/>">
										</td>
										<td><input id="aug0" type="text"
											class="shorttextbox" name="gml8" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml8}" pattern="###"/>">
										</td>
										<td><input id="sep0" type="text"
											class="shorttextbox" name="gml9" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml9}" pattern="###"/>">
										</td>
										<td><input id="oct0" type="text"
											class="shorttextbox" name="gml10" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml10}" pattern="###"/>">
										</td>
										<td><input id="nov0" type="text"
											class="shorttextbox" name="gml11" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml11}" pattern="###"/>">
										</td>
										<td><input id="dec0" type="text"
											class="shorttextbox" name="gml12" 
											onKeyPress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}"
											value="<fmt:formatNumber value="${htinfo.gml12}" pattern="###"/>">
										</td>
									</tr>
							</tbody>
						</table>
					</td>
				</tr>
		 <tr>
        	
            <td >
                                        条款模板:
            </td>
            <td colspan="5">            	 
            	<div class="select"><div>            	
            	<select style="width:180px" onchange="changeTabForHttk(this.value)" name="tkbm">
            	<!-- <option value="-1" selected>默认条款</option> -->
                   <c:forEach var="mb" items="${mbtk}">
                   <option value="${mb.id}">
                   ${mb.name}
                   </option>
                   </c:forEach>
                 </select>
            	
            	</div></div>
            </td>            
        </tr>
				<tr>
					<td colspan="6">
						<table id="httk" cellpadding="0" cellspacing="0" border="0"
							class="content1">
						<c:forEach var="tk" items="${djtk}">
								<tr>
									<td><span id="">${tk.xh}${tk.biaot} </span></td>
									<td><textarea id="neir" cols="150" rows="2" class="textarea" name="neir">${tk.neir}</textarea>
									</td>
								</tr>
						</c:forEach>	
						</table>
						<input type="hidden" id="tkjson" name="tkjson">
					</td>
				</tr>
				<tr>
					<td colspan="6">
						<table cellpadding="0" cellspacing="0" style="width:100%"
							class="content_gridview" border="1">
							<thead>
								<tr>
									<th colspan="2">出卖人</th>
									<th colspan="2">买受人</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>
										<table cellpadding="0" cellspacing="0" border="0"
											class="content1">
											<tr>
												<td>出卖人名称(章)：</td>
												<td><input id="qiymc" type="text" class="longtextbox"
													value="${htinfo.chumdwmc}" />
												</td>
											</tr>
											<tr>
												<td>住 所:</td>
												<td><input id="chumdwdz" type="text" name="chumdwdz"
													class="longtextbox" value="${htinfo.chumdwdz}" />
												</td>
											</tr>
											<tr>
												<td>法定代表人:</td>
												<td><input id="chumdwfddbr" type="text"
													name="chumdwfddbr" class="longtextbox"
													value="${htinfo.chumdwfddbr}" />
												</td>
											</tr>
											<tr>
												<td>委托代理人:</td>
												<td><input id="chumdwwtdlr" type="text"
													name="chumdwwtdlr" class="longtextbox"
													value="${htinfo.chumdwwtdlr}" />
												</td>
											</tr>
											<tr>
												<td>电 话:</td>
												<td><input id="chumdwdh" type="text" name="chumdwdh"
													class="longtextbox" value="${htinfo.chumdwdh}" />
												</td>
											</tr>
											<tr>
												<td>传真:</td>
												<td><input id="chumdwcz" type="text" name="chumdwcz"
													class="longtextbox" value="${htinfo.chumdwcz}" />
												</td>
											</tr>
											<tr>
												<td>邮政编码:</td>
												<td><input id="chumdwyzbm" type="text"
													name="chumdwyzbm" class="longtextbox"
													value="${htinfo.chumdwyzbm}" />
												</td>
											</tr>
											<tr>
												<td>开户银行:</td>
												<td><input id="chumdwkhyh" type="text"
													name="chumdwkhyh" class="longtextbox"
													value="${htinfo.chumdwkhyh}" />
												</td>
											</tr>
											<tr>
												<td>帐号:</td>
												<td><input id="chumdwzh" type="text" name="chumdwzh"
													class="longtextbox" value="${htinfo.chumdwzh}" />
												</td>
											</tr>
											<tr>
												<td>纳税人登记号:</td>
												<td><input id="chumdwnsrdjh" type="text"
													name="chumdwnsrdjh" class="longtextbox"
													value="${htinfo.chumdwnsrdjh}" />
												</td>
											</tr>

										</table>
									</td>
									<td><table cellpadding="0" cellspacing="0" border="0"
											class="content1">
											<tr>
												<td>出卖人结算单位名称(章)：</td>
												<td>
													<div class="select">
														<div>
															<select style="width:180px" id="chumdwjsrbm" name="chumdwjsrbm" onchange="changeTabForJsdw(this.value,'1')">            	
                                                            </select>
														</div>
													</div> <input id="cmdwjsrmc" type="hidden" name="chumdwjsrmc"
													value="${htinfo.chumdwjsrmc}">
												</td>
											</tr>
											<tr>
												<td>住 所:</td>
												<td><input id="szs" type="text" name="chumdwjsrdz"
													class="longtextbox" value="${htinfo.chumdwjsrdz}" />
												</td>
											</tr>
											<tr>
												<td>法定代表人:</td>
												<td><input id="sfddbr" type="text"
													name="chumdwjsrfddbr" class="longtextbox"
													value="${htinfo.chumdwjsrfddbr}" />
												</td>
											</tr>
											<tr>
												<td>委托代理人:</td>
												<td><input id="swtdlr" type="text"
													name="chumdwjsrwtdlr" class="longtextbox"
													value="${htinfo.chumdwjsrwtdlr}" />
												</td>
											</tr>
											<tr>
												<td>电 话:</td>
												<td><input id="sdh" type="text" name="chumdwjsrdh"
													class="longtextbox" value="${htinfo.chumdwjsrdh}" />
												</td>
											</tr>
											<tr>
												<td>传真:</td>
												<td><input id="scz" type="text" name="chumdwjsrcz"
													class="longtextbox" value="${htinfo.chumdwjsrcz}" />
												</td>
											</tr>
											<tr>
												<td>邮政编码:</td>
												<td><input id="syb" type="text" name="chumdwjsryzbm"
													class="longtextbox" value="${htinfo.chumdwjsryzbm}" />
												</td>
											</tr>
											<tr>
												<td>开户银行:</td>
												<td><input id="skhyh" type="text"
													name="chumdwjsrkhyh" class="longtextbox"
													value="${htinfo.chumdwjsrkhyh}" />
												</td>
											</tr>
											<tr>
												<td>帐号:</td>
												<td><input id="szh" type="text" name="chumdwjsrzh"
													class="longtextbox" value="${htinfo.chumdwjsrzh}" />
												</td>
											</tr>
											<tr>
												<td>纳税人登记号:</td>
												<td><input id="sdjh" type="text"
													name="chumdwjsrnsrdjh" class="longtextbox"
													value="${htinfo.chumdwjsrnsrdjh}" />
												</td>
											</tr>

										</table></td>
									<td><table cellpadding="0" cellspacing="0" border="0"
											class="content1">
											<tr>
												<td>买受人名称(章)：</td>
												<td><input id="maisr" type="text" class="longtextbox"
													value="${htinfo.maisdwmc}" />
												</td>
											</tr>
											<tr>
												<td>住 所:</td>
												<td><input id="zs" type="text" name="maisdwdz"
													class="longtextbox" value="${htinfo.maisdwdz}" />
												</td>
											</tr>
											<tr>
												<td>法定代表人:</td>
												<td><input id="fddbr" type="text" name="maisdwfddbr"
													class="longtextbox" value="${htinfo.maisdwfddbr}" />
												</td>
											</tr>
											<tr>
												<td>委托代理人:</td>
												<td><input id="wtdlr" type="text" name="maisdwwtdlr"
													class="longtextbox" value="${htinfo.maisdwwtdlr}" />
												</td>
											</tr>
											<tr>
												<td>电 话:</td>
												<td><input id="dh" type="text" name="maisdwdh"
													class="longtextbox" value="${htinfo.maisdwdh}" />
												</td>
											</tr>
											<tr>
												<td>传真:</td>
												<td><input id="cz" type="text" name="maisdwcz"
													class="longtextbox" value="${htinfo.maisdwcz}" />
												</td>
											</tr>
											<tr>
												<td>邮政编码:</td>
												<td><input id="yb" type="text" name="maisdwyzbm"
													class="longtextbox" value="${htinfo.maisdwyzbm}" />
												</td>
											</tr>
											<tr>
												<td>开户银行:</td>
												<td><input id="khyh" type="text" name="maisdwkhyh"
													class="longtextbox" value="${htinfo.maisdwkhyh}" />
												</td>
											</tr>
											<tr>
												<td>帐号:</td>
												<td><input id="zh" type="text" name="maisdwzh"
													class="longtextbox" value="${htinfo.maisdwzh}" />
												</td>
											</tr>
											<tr>
												<td>纳税人登记号:</td>
												<td><input id="djh" type="text" name="maisdwnsrdjh"
													class="longtextbox" value="${htinfo.maisdwnsrdjh}" />
												</td>
											</tr>

										</table></td>
									<td><table cellpadding="0" cellspacing="0" border="0"
											class="content1">
											<tr>
												<td>买受人结算单位名称(章)：</td>
												<td>
													<div class="select">
														<div>
															<select style="width:180px;" id="maisdwjsrbm"
																name="maisdwjsrbm"
																onChange="changeTabForJsdw(this.value,'0')"></select>
														</div>
													</div> <input id="msdwjsrmc" type="hidden" name="maisdwjsrmc"
													value="${htinfo.maisdwjsrmc}">
												</td>
											</tr>
											<tr>
												<td>住 所:</td>
												<td><input id="bzs" type="text" name="maisdwjsrdz"
													class="longtextbox" value="${htinfo.maisdwjsrdz}" />
												</td>
											</tr>
											<tr>
												<td>法定代表人:</td>
												<td><input id="bfddbr" type="text"
													name="maisdwjsrfddbr" class="longtextbox"
													value="${htinfo.maisdwjsrfddbr}" />
												</td>
											</tr>
											<tr>
												<td>委托代理人:</td>
												<td><input id="bwtdlr" type="text"
													name="maisdwjsrwtdlr" class="longtextbox"
													value="${htinfo.maisdwjsrwtdlr}" />
												</td>
											</tr>
											<tr>
												<td>电 话:</td>
												<td><input id="bdh" type="text" name="maisdwjsrdh"
													class="longtextbox" value="${htinfo.maisdwjsrdh}" />
												</td>
											</tr>
											<tr>
												<td>传真:</td>
												<td><input id="bcz" type="text" name="maisdwjsrcz"
													class="longtextbox" value="${htinfo.maisdwjsrcz}" />
												</td>
											</tr>
											<tr>
												<td>邮政编码:</td>
												<td><input id="byb" type="text" name="maisdwjsryzbm"
													class="longtextbox" value="${htinfo.maisdwjsryzbm}" />
												</td>
											</tr>
											<tr>
												<td>开户银行:</td>
												<td><input id="bkhyh" type="text"
													name="maisdwjsrkhyh" class="longtextbox"
													value="${htinfo.maisdwjsrkhyh}" />
												</td>
											</tr>
											<tr>
												<td>帐号:</td>
												<td><input id="bzh" type="text" name="maisdwjsrzh"
													class="longtextbox" value="${htinfo.maisdwjsrzh}" />
												</td>
											</tr>
											<tr>
												<td>纳税人登记号:</td>
												<td><input id="bdjh" type="text"
													name="maisdwjsrnsrdjh" class="longtextbox"
													value="${htinfo.maisdwjsrnsrdjh}" />
												</td>
											</tr>

										</table></td>

								</tr>
							</tbody>
						</table>
					</td>

				</tr>
				<tr>
					<td colspan="4"><font size="2" color="#FF0000"></font></td>
					<td align="right">        
                      <font size="2" >年度：</font>
                      <input type="text" id="nianf" name="nianf" class="textbox"	value="${htinfo.nianf}" readonly />         
                    </td>
					<td align="left" >					
					<font size="2">合同有效期：<input
							id="kssj" type="text" name="youxqxkssj" class="textbox"
							value="${htinfo.youxqxkssj}" readonly /> 至<input id="jssj"
							type="text" class="textbox" name="youxqxjssj"
							value="${htinfo.youxqxjssj}" readonly /> </font></td>
							<input type="hidden" id="cDate" value="${currentDate}">
        <input type="hidden" id="eDate" value="${endDate}">
				</tr>
				<c:if test="${htinfo.zhuangt==6}">
					<tr>
						<td>&nbsp;</td>
						<td colspan="4">
							<table cellpadding="0" cellspacing="0" border="0"
								class="content_gridview">
								<tr>
									<td colspan="2" bgColor="#859dbe"><font size="5px"
										color="#000">审批意见</font></td>
								</tr>
								<c:forEach var="spyj" items="${spyj}">
								<tr>
								<td width="30%">${spyj.nodename}&nbsp;</td>
								<td width="70%">${spyj.shenhyj}&nbsp;</td>
								</tr>
						        </c:forEach>
							</table>
						</td>
						<td>&nbsp;</td>
					</tr>
				</c:if>
				<tr>
					<td colspan="6" align="center"><input id="but1" type="button"
						name="" value="保存" /> &nbsp;&nbsp;&nbsp; <input id="but2"
						type="button" name="" value="保存并提报" />&nbsp;&nbsp;&nbsp;<input
						id="but3" type="button" name="" value="关闭"
						onClick="window.returnValue=1;window.close();" /></td>
				</tr>
			</table>
			<input type="hidden" name="sysid" value="${htinfo.sysid}">
			<input type="hidden" name="dongzlx" value="3"> <input
				type="hidden" name="dongzbm" value="22">
		</form>
	</div>

<div id="dialog-confirm" title="是否确认提交？"></div>
  </body>
</html>

